#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const double EPS = 1e-9;
int n, m;
pdd pos[20];
set<pdd> st;
vector<pdd> a;
vector<int> f[18];
int g[165];
int dp[1 << 18];
pdd solve(pdd p1, pdd p2) {
  double x1 = p1.first, y1 = p1.second;
  double x2 = p2.first, y2 = p2.second;
  double b = (y1 * x2 * x2 - y2 * x1 * x1) / (x1 * x2 * x2 - x1 * x1 * x2);
  double a = (y1 - b * x1) / (x1 * x1);
  return pdd(a, b);
}
bool check_in(pdd pt, pdd c) {
  double x = pt.first, y = pt.second;
  double a = c.first, b = c.second;
  return abs(y - a * x * x - b * x) < EPS;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    rep(i, 0, n - 1) cin >> pos[i].first >> pos[i].second;
    st.clear(), a.clear();
    rep(i, 0, n - 1) {
      rep(j, i + 1, n - 1) {
        if (pos[i].first != pos[j].first) st.insert(solve(pos[i], pos[j]));
      }
    }
    for (pdd c : st) {
      if (c.first < 0) a.push_back(c);
    }
    m = a.size();
    rep(i, 0, n - 1) f[i].clear();
    rep(j, 0, m - 1) g[j] = 0;
    rep(j, 0, m - 1) {
      rep(i, 0, n - 1) {
        if (check_in(pos[i], a[j])) f[i].push_back(j), g[j] |= 1 << i;
      }
    }
    int mask = (1 << n) - 1;
    rep(s, 1, mask) {
      dp[s] = 100;
      rep(i, 0, n - 1) {
        if (s & (1 << i)) {
          dp[s] = min(dp[s], 1 + dp[s ^ (1 << i)]);
          for (int j : f[i]) {
            int s1 = s & (~g[j]);
            dp[s] = min(dp[s], 1 + dp[s1]);
          }
        }
      }
    }
    cout << dp[mask] << endl;
  }
  return 0;
}